home *** CD-ROM | disk | FTP | other *** search
- /* The basic outline for Mark Johnson's C GEM programs
- *
- * A Program showing use of the file selector box
- * and alert boxes.
- * adapted from ST-Log March 1987 by Mark Kelling
- */
-
- #include <gem.h> /* The GEM library hook*/
- /* no <osbin.h> or <stdio.h> required or allowed */
-
- /* Your basic required GEM globals */
- int work_in[11],
- work_out[57],
- pxyarray[10],
- contrl[12],
- intin[128],
- ptsin[128],
- intout[128],
- ptsout[128];
-
- /* Globals for the program */
- int handle, dum, i;
-
- /* Main program */
- main() /* Notice no argv, argc */
- {
- /* Initialization section */
- appl_init (); /* Tell GEM to initialize our program */
- handle = graf_handle(&dum,&dum,&dum,&dum); /* Get a handle */
- for (i=0;i<10; work_in[i++] = 1 ); /* Set up arrays */
- work_in[10] = 2;
- v_opnvwk (work_in, &handle, work_out); /* Open it up */
- /*The 'good stuff' */
- sel_file (); /* Get a file name */
- v_clsvwk (handle); /* Close our workstation */
- /* Back to desk; MUST NOT put appl_exit here!! */
- } /* End of main */
-
- sel_file () /* Use the file selector box and show the results */
- {
- int button ; /* Button value */
- char path[80], /* Filename strings */
- file[13];
-
- for (i=0; i<40; path[i++]='\0'); /* Pad filename with nulls*/
- for (i=0; i<13; file[i++]='\0');
- path[0] = Dgetdrv() + 65; /* Find current drive */
- path[1] = ":\*.*" ; /* Set default path*/
- fsel_input(path, file, &button);
- show_info (button) ; /*Use alert to show results */
- }
-
- show_info (button) /* Make an alert box to show choice */
- int button ; /* Which button was pressed */
- {
- if (button == 0)
- form_alert( 1,"[3][You did not |choose a file!][ok]");
- else
- form_alert(1,"[2][You chose one|of the files.][got it]");
- /* Currently, form_alert will only accept a string constant as shown here */
- }
-
- int
- Dgetdrv () { return trap(1,0x19); } /* Finds the active drive */
-